home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 12 / CU Amiga Magazine's Super CD-ROM 12 (1997)(EMAP Images)(GB)[!][issue 1997-07].iso / Netconnect / AmiTCP / Install AmiTCP < prev    next >
Text File  |  1996-12-12  |  28KB  |  910 lines

  1. ;;;; Hey Emacs, this script might as well be -*- lisp -*-
  2. ;;;;
  3. ;;;; Install AmiTCP - AmiTCP/IP installation script for Installer
  4. ;;;;
  5. ;;;; Copyright © 1996 AmiTCP/IP Group,
  6. ;;;;                  NSDi - Network Solutions Development Inc., Finland
  7. ;;;;                  All rights reserved.
  8. ;;;;
  9. ;;;; $Id: Install\040AmiTCP,v 4.5 1996/12/01 17:13:30 too Exp $
  10. ;;;;
  11. ;;;; This script has been tested with Installer.
  12. ;;;;
  13. ;;;;     Installer and Installer project icon
  14. ;;;;     (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
  15. ;;;;     Reproduced and distributed under license from Commodore.
  16. ;;;;
  17. ;;;;     INSTALLER SOFTWARE IS PROVIDED "AS-IS" AND SUBJECT TO CHANGE;
  18. ;;;;     NO WARRANTIES ARE MADE.  ALL USE IS AT YOUR OWN RISK.  NO LIABILITY
  19. ;;;;     OR RESPONSIBILITY IS ASSUMED.
  20. ;;;;
  21. ;;;; Use following Icon tooltypes / Command line options:
  22. ;;;; APPNAME=AmiTCP/IP
  23. ;;;; MINUSER=AVERAGE
  24. ;;;;
  25. ;;;;
  26. ;;;; What we are?
  27. ;;;;
  28.  
  29. (set app-vers "4.5"
  30.      app-type "DialUpDemo")
  31.  
  32. (set app-name (cat @app-name "-" app-type " " app-vers)
  33.      app-dir-name (cat "AmiTCP-" app-type "-" app-vers))
  34.  
  35. (welcome "    Welcome to the " app-name " installation.\n")
  36.  
  37. (if (= @pretend 1)
  38.     (set pretend-extra "\nNote: `Make New Drawer' will make new drawer even in PRETEND mode")
  39. (set pretend-extra ""))
  40.  
  41. (set
  42. ;;;;
  43. ;;;; "Needs"
  44. ;;;;
  45.  need-version 37  ; version of operating system need by AmiTCP/IP
  46.  need-memory (* 512 1024)
  47.  
  48.  AmiTCP-release-number 4 ; this release
  49. ;;;
  50. ;;; Installation disk names
  51. ;;;
  52. ; install-disk1-name (cat "AmiTCP-" app-type "-" app-vers ":")
  53.  install-disk1-name ""
  54. ;;;
  55. ;;; Used pkt-files, source-dir will remain on the disk from which the 
  56. ;;; installer was started!
  57. ;;;
  58.  AmiTCP-pkt-file (tackon install-disk1-name "AmiTCP.pkt")
  59.  Docs-pkt-file (tackon install-disk1-name "AmiTCPDocs.pkt")
  60.  NapsaFonts-pkt-file (tackon install-disk1-name "NapsaFonts.pkt")
  61. ;;;
  62. ;;; Other sources on installation disks
  63. ;;;
  64.  dist-networks-dir (tackon install-disk1-name "Devs/Networks")
  65.  dist-providers-dir (tackon install-disk1-name "providers")
  66.  Installer-file (tackon install-disk1-name "Installer")
  67.  UnPkt-file (tackon install-disk1-name "UnPkt")
  68.  LICENSE-file (tackon install-disk1-name "LICENSE")
  69.  README-FIRST-file (tackon install-disk1-name "Read Me First")
  70.  info.AmiTCPdir-file (tackon install-disk1-name "info.AmiTCPdir")
  71. )
  72.  
  73. (set 
  74.  
  75. ;;;
  76. ;;; Destination directories of the AmiTCP/IP
  77. ;;;
  78.  atcp-name "AmiTCP"
  79.  atcp-assign (cat atcp-name ":")    ; Assign to AmiTCP
  80.  ;; Configuration
  81.  conf-dir (tackon atcp-assign "db")
  82.  ;; User binaries
  83.  bin-dir (tackon atcp-assign "bin")
  84.  ;; documentation
  85.  doc-dir (tackon atcp-assign "doc")
  86.  ;; devices directory
  87.  devs-dir (tackon atcp-assign "devs")
  88.  ;; DOS handlers
  89.  l-dir (tackon atcp-assign "l")
  90.  ;; libraries
  91.  libs-dir (tackon atcp-assign "libs")
  92.  ;; providers 
  93.  prov-dir (tackon atcp-assign "providers")
  94.  ;; dialup scrips
  95.  ssrx-dir (tackon atcp-assign "ssrx")
  96.  
  97.  ;;
  98.  ;; The source directory name
  99.  source-dir (if (= 1 (exists @icon))
  100.         (pathonly (expandpath @icon))
  101.           (expandpath @icon))
  102.  ;; Mounts
  103.  apipe-mount (cat 
  104.           "Assign APIPE: Exists > NIL:\n" 
  105.           "IF Warn\n"
  106.           "  Mount APIPE: from AmiTCP:devs/APipe-Mountlist\n"
  107.           "EndIf\n")
  108.  )
  109. ;; How to get needed information?
  110. (set
  111.  net-setup-help
  112.  "    You can get this information from your network administration.\n")
  113.  
  114. ;;; copy "more" to ram: to be able to use it
  115. (set
  116.  pager-cmd 
  117.  (if (exists "SYS:Utilities/More" (noreq))
  118.      ((copyfiles
  119.        (prompt "Copying sys:utilities/more to ram: for use")
  120.        (source "SYS:Utilities/More")
  121.        (dest   "RAM:")
  122.        (safe)
  123.        (optional "nofail"))
  124.       "RAM:More")
  125.    ("more"))
  126.  )
  127.  
  128. ;; Return old AmiTCP: assign if we are aborting
  129. (onerror
  130.  (if old-atcp-directory
  131.      (makeassign atcp-name old-atcp-directory)))
  132.  
  133. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  134. (procedure
  135.  check-system-version
  136.  ;; is your Exec recent enough?
  137.  (set exec-version (/ (getversion) 65536))
  138.  (transcript "Running on exec version " exec-version ".")
  139.  (if (< exec-version need-version)    ; check operating system version
  140.      ((transcript "Installation aborted due too old operating system.")
  141.       (abort "AmiTCP/IP requires at least operating system 2.04"))))
  142.  
  143.  
  144. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  145. (procedure
  146.  check-available-memory
  147.  ;;
  148.  (transcript "Checking available memory.")
  149.  (set avail-mem (+ (database "total-mem")))
  150.  (if (< avail-mem need-memory)
  151.      ((message "Your system has only " (/ avail-mem 1024) " kilobytes of "
  152.            "free memory, while the " @app-name " needs at least "
  153.            (/ need-memory 1024) " to be useful.\n"
  154.            "You can continue the installation but be warned!")
  155.       (transcript "User decided to continue installation while available "
  156.           "memory was below the recommended minimum."))))
  157.  
  158. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  159. (procedure
  160.  check-user-level
  161.  ;;
  162.  (transcript "Checking user level.")
  163.  (if (< @user-level 1)
  164.      ((transcript "Installation aborted due to too low user level.")
  165.       (abort "AmiTCP/IP installation requires at least the \"average\" "
  166.          "user level. Restart installation and select appropriate user "
  167.          "level."))))
  168.  
  169. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  170. (procedure
  171.  check-old-assign
  172.  ;; If there is already the AmiTCP/IP installed, store the assign
  173.  ;; to old-atcp-directory
  174.  (transcript "Checking for already installed AmiTCP.")
  175.  (set old-atcp-directory 
  176.       (if (exists atcp-assign (noreq))
  177.       (getassign atcp-name)
  178.     ""))
  179.  (if old-atcp-directory
  180.      (transcript "Existing AmiTCP detected at directory " 
  181.          old-atcp-directory ".")))
  182.  
  183. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  184.  
  185. (procedure
  186.  check-cpu-type
  187.  (set cpu-type (database "cpu"))
  188.  (set cpu-is-020-or-better
  189.       (AND (<> cpu-type "68000")
  190.        (<> cpu-type "68010")))
  191.  )
  192.  
  193. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  194. (procedure
  195.  ask-accept-license ;; Ask if the user accepts license conditions
  196.  (transcript "Asking if the user accepts the license conditions.")
  197. ;;
  198. ;; use "more" to show the full license text
  199. ;;
  200.  (run (cat "run " pager-cmd) LICENSE-file (safe))
  201.  (message "\nAmiTCP/IP is a copyrighted propiertary software of "
  202.       "\"Network Solutions Development Inc.\"\n"
  203.           "\nPlease read the shown license text carefully.\n"
  204.           "\nBy proceeding the installation of this software you "
  205.       "indicate that you accept the license conditions.\n"
  206.       )
  207.  )
  208.  
  209. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  210. (procedure
  211.  select-destination-directory
  212.  ;; Select destination directory for the installation.
  213.  ;; This is the floppy install-version
  214.  ;;
  215.  (transcript "Selecting destination directory for the installation.")
  216.  (set atcp-dest
  217.       (askdir
  218.        (prompt "Select directory where to install\nthe " app-name "."
  219.            pretend-extra)
  220.        (help "    Here you can specify location where to install "
  221.          "the " app-name ".\n"
  222.          "    Installation must NOT be made on top of an older "
  223.          "version of the " @app-name ".\n"
  224.          "  Installer will create a subdirectory called `"
  225.          app-dir-name "' to the selected directory and copy the " 
  226.          @app-name " files to it.")
  227.        (newpath)
  228.        (default 
  229.      (if (= 2 (exists "Work:" (noreq)))
  230.          "Work:" 
  231.        (cat (getdevice "SYS:") ":")))
  232.        ))
  233.  (textfile (dest (tackon atcp-dest (cat app-dir-name ".info")))
  234.        (include info.AmiTCPdir-file))
  235.  (set atcp-dest (tackon atcp-dest app-dir-name))
  236.  (if (= pretend 0) (set @default-dest atcp-dest))
  237.  (makedir atcp-dest (infos))
  238.  (message app-name " will be installed in:\n\n" atcp-dest)
  239.  
  240.  ;; Make the AmiTCP: assign
  241.  (if (= @pretend 0)
  242.      ((makeassign atcp-name atcp-dest)
  243.       (if (NOT (= 2 (exists (tackon atcp-assign "devs"))))
  244.       (makedir (tackon atcp-assign "devs")))))
  245. )
  246.  
  247. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  248. ;;
  249. ;; This is floppy-install version
  250. ;;
  251. ;; arguments:
  252. ;;
  253. ;;   unpkt-source      - the source archive
  254. ;;   unpkt-destination - the destination directory
  255. ;;   unpkt-sdp         - number of directories to strip
  256. ;;   unpkt-title-name  - descriptive name of the archive
  257. ;;   unpkt-title-not   - installation unit name
  258.  
  259.  
  260. (procedure
  261.  run-unpkt 
  262.  ;;
  263.  (if (exists unpkt-source)
  264.      ((transcript "Dearchiving " unpkt-source " files to " unpkt-destination ".")
  265.       (working "Writing files to " unpkt-destination "...")
  266.       (if (= @pretend 0) 
  267.       ((if (run (cat unpkt-cmd " "
  268.              "\"" unpkt-source "\" "
  269.              "\"" unpkt-destination "\""
  270.              " SDP=" unpkt-sdp 
  271.              " >\"CON:9/9/600/100/UnPkt Output/INACTIVE/AUTO\" "))
  272.        (abort "    UnPkt could not dearchive the " unpkt-source ". "
  273.           "This may be due to:\n"
  274.           "    1) Not enough disk space\n"
  275.           "    2) Not enough memory\n"
  276.           "    3) Corrupted archive\n"
  277.           "    4) Corrupted UnPkt\n"))))
  278.       1)
  279.    ((transcript unpkt-source " could not be located, and is NOT installed!")
  280.     (message "\nWARNING\n\n"
  281.          "Could not locate the " unpkt-title-name " archive.\n"
  282.          unpkt-title-not " is NOT installed!")
  283.     0))
  284.  )
  285.  
  286.  
  287. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  288. ;;
  289. ;; This is floppy-install version
  290. ;;
  291. (procedure
  292.  copy-files-to-destination ;;; UnPkt AmiTCP/IP files to the destination
  293.  ;;
  294.  
  295.  (set 
  296.   unpkt-source AmiTCP-pkt-file
  297.   unpkt-destination atcp-dest
  298.   unpkt-sdp 1
  299.   unpkt-title-name "AmiTCP/IP program"
  300.   unpkt-title-not "AmiTCP/IP"
  301.   )
  302.  (if (run-unpkt)
  303.      (
  304.       ;;
  305.       ;; Copy the Installer
  306.       ;;
  307.       (copyfiles
  308.        (source Installer-file)
  309.        (dest bin-dir)
  310.        (files)
  311.        (infos))
  312.  
  313.       ;;
  314.       ;; Create AmiTCP:log if it does not exist already
  315.       ;;
  316.       (if (NOT (= 2 (exists (tackon atcp-assign "log"))))
  317.       (makedir (tackon atcp-assign "log")))
  318.       ;;
  319.       ;; Create AmiTCP:log/wtmp if it does not exist already
  320.       ;;
  321.       (if (NOT (= 1 (exists (tackon atcp-assign "log/wtmp"))))
  322.       (textfile (dest (tackon atcp-assign "log/wtmp"))))
  323.  
  324.       (copy-providers)
  325.     
  326.       ;; AmiTCP/IP program archive installed succesfully
  327.       1)
  328.    0))
  329.  
  330. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  331. (procedure
  332.  copy-providers
  333.  (transcript "Copying provider files.")
  334.  ;;
  335.  ;; Create directory AmiTCP:providers if it does not exist already
  336.  ;;
  337.  (set tmp-var (tackon atcp-assign "providers"))
  338.  (if (NOT (= 2 (exists tmp-var)))
  339.      (makedir tmp-var))
  340.  (copyfiles
  341.   (prompt "Copying provider files")
  342.   (source dist-providers-dir)
  343.   (dest tmp-var)
  344.   (all)
  345.   (optional "nofail"))
  346.  )
  347.  
  348. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  349. (procedure
  350.  update-devices
  351.   (transcript "Updating Sana-II device drivers.")
  352.  ;;
  353.  ;; Create directory DEVS:Networks if it does not exist already
  354.  ;;
  355.  (if (NOT (= 2 (exists "DEVS:Networks")))
  356.      (makedir "DEVS:Networks"))
  357.  ;;
  358.  ;; Copy each driver in the distribution to the DEVS:Networks if necessary
  359.  ;;
  360.  (working "Checking Sana-II device drivers...")
  361.  (if (= 2 (exists dist-networks-dir))
  362.      (foreach
  363.        dist-networks-dir "#?.device"
  364.        ((set dist-name (tackon dist-networks-dir @each-name)
  365.          devs-name (tackon "DEVS:Networks" @each-name)
  366.          dist-version (getversion dist-name)
  367.          copy-it (NOT (exists devs-name)))
  368.     ;;
  369.     ;; Check if the driver should be copied over
  370.     ;;
  371.     (if (NOT copy-it)
  372.         (set copy-it
  373.                  ; or if the driver in DEVS:Networks is of older version
  374.          (< (set devs-version (getversion devs-name)) dist-version)))
  375.     (if (NOT copy-it)
  376.         (set copy-it
  377.              ; or if the files are of the same version but different
  378.          (set sum-differs (if (= dist-version devs-version)
  379.                       (<> (getsum dist-name)
  380.                       (getsum devs-name))
  381.                     0))))
  382.     (if copy-it
  383.         (copyfiles
  384.          (prompt "Should this Sana-II driver be installed in Devs:Networks?\n"
  385.              (if devs-version
  386.              (cat "A driver with the same name exists already"
  387.                   (if sum-differs
  388.                   (cat ", it has the same version, but the "
  389.                        "files are not the same.")
  390.                 (cat ", but the driver in the "
  391.                      "DEVS:Networks is of older version.")))
  392.                ""))
  393.          (help
  394.           "    The Sana-II drivers should be located in "
  395.           "the DEVS:Networks directory.\n"
  396.           "    This directory is the official location for the Sana-II "
  397.           "device drivers.")
  398.          (source (pathonly dist-name))
  399.          (choices (fileonly dist-name))
  400.          (dest "DEVS:Networks")
  401.          (files)
  402.          (optional "nofail" "askuser")
  403.          (confirm "average")))))
  404.    (message "No Sana-II drivers found on the installation disk")
  405.    )
  406.  )
  407.  
  408. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  409. (procedure
  410.  ask-update-devices
  411.  (if (= 2 (exists dist-networks-dir))
  412.      (if (askbool
  413.       (prompt "\nDo you want to update your Sana-II network device "
  414.           "drivers?\n"
  415.           "Each copy will be confirmed.")
  416.           (help
  417.            "    Each new AmiTCP/IP distribution usually contains "
  418.            "updated versions of some of the provided Sana-II network "
  419.            "device drivers. If you choose \"Yes\", this installation "
  420.            "script will check for each device, if this is the case."))
  421.          (update-devices)
  422.        (transcript "User did not want to update Sana-II drivers."))
  423.    (transcript "Directory " dist-networks-dir " not found.")))
  424.  
  425. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  426. ;; 
  427. ;; arguments:
  428. ;;
  429. ;; uus::commands - commands to add
  430. ;; uus::section  - section name
  431. ;; uus::file     - file name into which to save the changes if needed
  432. ;;
  433. (procedure
  434.  update-user-startup
  435.  (set uus::complete (cat ";BEGIN " uus::section "\n"
  436.              uus::commands
  437.              ";END " uus::section "\n"))
  438.  (set startup-changed 1)
  439.  (startup
  440.   uus::section
  441.   (command uus::commands)
  442.   (prompt "Installer will modify your S:User-Startup file. "
  443.       "Following lines will be appended to it:\n\n"
  444.       uus::complete)
  445.   (help "   Installer needs to make indicated modifications to "
  446.     "your user startup file.\n"
  447.     "   You should make modifications later by hand "
  448.     "if you skip this part."))
  449.  )
  450.  
  451. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  452. (procedure
  453.  ask-copy-old-configuration
  454.  ;;
  455.  ;; Copy old configuration files
  456.  ;; Returns TRUE if AmiTCP does not need to be configured.
  457.  ;; The reconfiguration is forced now.
  458.  ;;
  459.  (set
  460.   edit-change-fingerd "t:edit-change-fingerd"
  461.   old-conf-dir (tackon old-atcp-directory "db")
  462.   old-devs-dir (tackon old-atcp-directory "devs")
  463.   old-motd (tackon old-conf-dir "motd"))
  464.  ;;
  465.  ;; return version of the old AmiTCP detected
  466.  ;;
  467.  (procedure 
  468.   get-old-atcp-version
  469.   (if (exists (tackon old-atcp-directory "AmiTCP") (noreq))
  470.       (/ (getversion (tackon old-atcp-directory "AmiTCP")) 65536)
  471.     0))
  472.  ;;
  473.  (set old-atcp-version (get-old-atcp-version))
  474.  ;;
  475.  
  476.  (procedure 
  477.   copy-rest-config
  478.   (set ask-options-bitmap 
  479.        (askoptions
  480.     (prompt
  481.      "Select configuration files you want to copy from old configuration"
  482.      "\nThe files you choose will be copied to the new configuration "
  483.      "directory when you press `Proceed'")
  484.     (help
  485.     "    You may copy your old configuration files or use untouched files "
  486.     "came with the new distribution.\nAll the files mentioned may not"
  487.     " be present in your current configuration.")
  488.  
  489.     (choices
  490.     "AmiTCP.config"
  491.     "autointerfaces"
  492.     "group"
  493.     "hosts"
  494. ; NO!    "inetd.conf"
  495.     "networks"
  496.     "resolv.conf"
  497.     "services"
  498.     "protocols"
  499.     "provider.conf"
  500.     "passwd"
  501.     "rpc"
  502.     )))
  503.  
  504.   (set n 0)
  505.   (while (set thisfile (select n
  506.                    "AmiTCP.config"
  507.                    "autointerfaces"
  508.                    "group"
  509.                    "hosts"
  510. ; NO!                   "inetd.conf"
  511.                    "networks"
  512.                    "resolv.conf"
  513.                    "services"
  514.                    "protocols"
  515.                    "provider.conf"
  516.                    "passwd"
  517.                    "rpc"
  518.                    ""))
  519.     ((if (and (in ask-options-bitmap n)
  520.          (exists (tackon old-conf-dir thisfile)))
  521.     (copyfiles
  522.      (prompt "Copying " thisfile " to " conf-dir)
  523.      (source (tackon old-conf-dir thisfile))
  524.      (dest conf-dir)
  525.      (optional "nofail" "force")))
  526.      )
  527.     (set n (+ n 1))
  528.   ))
  529.  
  530.  ;;
  531.  (procedure 
  532.   copy-motd
  533.   (if (exists old-motd)
  534.       ((if (>= @user-level 2)
  535.        (message "\nCopying file\n\n"
  536.             old-motd "\n"
  537.             "(Message Of The Day)\n"
  538.             "\nto directory \"" conf-dir "\"."))
  539.        (copyfiles
  540.     (source old-motd)
  541.     (dest conf-dir)
  542.     (files)))))
  543.  (procedure
  544.   update-services
  545.   (set service-file (tackon conf-dir "services"))
  546.   (if (run (cat "search search \"amiganetfs\" quiet from " service-file)
  547.        (safe))
  548.       (;; Not found, add it 
  549.        (textfile (dest service-file)
  550.          (include service-file)
  551.          (append ";\n; Amiga specific services\n;\n"
  552.              "amiganetfs      2500/tcp\n")
  553.          (prompt 
  554.           "Do you want to add AmigaNetFS service to your "
  555.           "service database?")
  556.          (help 
  557.           "    The " @app-name " includes NetFS, network file system "
  558.           "between Amigas, by Timo Rossi. It is a TCP based protocol "
  559.           "which requires both ends of connection have same service "
  560.           "(TCP port) entries. If you already had NetFS installed "
  561.           "you probably do not want to update your service "
  562.           "database.")
  563.          (confirm)))))
  564.  (procedure
  565.   update-hosts
  566.   (set hosts-file (tackon conf-dir "hosts"))
  567.   (if (run (cat "search search \"localhost\" quiet from " hosts-file)
  568.        (safe))
  569.       (;; Not found, add it
  570.        (transcript "Adding 'localhost' entry to the db/hosts.")
  571.        (textfile (dest hosts-file)
  572.          (include hosts-file)
  573.          (append ";\n; Entry for the localhost\n;\n"
  574.              "127.0.0.1 localhost\n")
  575.          ))))
  576.  ;;
  577.  (procedure 
  578.   update-napsaprefs
  579.   (set old-napsaprefs
  580.        (if (exists (tackon old-atcp-directory "db/NapsaPrefs") (noreq))
  581.        (tackon old-atcp-directory "db/NapsaPrefs")
  582.      (if (exists "s:NapsaPrefs")
  583.          "s:NapsaPrefs")
  584.      ""))
  585.   (if old-napsaprefs
  586.       (;;
  587.        (copyfiles 
  588.     (source old-napsaprefs)
  589.     (dest conf-dir)
  590.     (files)
  591.     (confirm)
  592.     (prompt "\nUse your old Napsaterm preferences?")
  593.     (help  "    Installer have found an existing NapsaPrefs file "
  594.            old-napsaprefs ". You can copy it to new configuration "
  595.            "directory.")))))
  596.  (procedure 
  597.   note-additional
  598.   (message
  599.    "Your old AmiTCP/IP configuration files were copied from an old installation "
  600.    "to the new. However, if you, or any of your installed programs, "
  601.    "have added additional configuration files (in db/) or programs (in bin/), "
  602.    "you need to transfer these to the new "
  603.    "installation manually.\n")
  604.   )
  605.  (transcript "Ready to copy old configuration.")
  606.  (if (askbool
  607.       (default 1)
  608.       (prompt
  609.        "\nDo you want to use settings from an earlier installation?")
  610.       (help
  611.        "    Installer have detected existing configuration "
  612.        "directory \"" old-conf-dir "\" which "
  613.        "can be used to configure the " app-name ". You can keep most "
  614.        "of your previous configuration. This is important if you have "
  615.        "installed extra applications.\n"
  616.        "    Configuration files will be "
  617.        (if (> @user-level 1) 
  618.        "optionally")
  619.        " copied.\n"))
  620.      (
  621.       (copy-rest-config)
  622.       (copy-motd)
  623.       (update-hosts)
  624.       (update-services)
  625.       (update-napsaprefs)
  626.       (note-additional)
  627.       0) ;; FALSE if AmiTCP needs to be reconfigured
  628.    0))
  629.  
  630. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  631. (procedure
  632.  install-napsaterm
  633.  ;;
  634.  ;; Install Napsaterm fonts
  635.  ;;
  636.  ;; Ask for directory to install fonts.
  637.  (procedure
  638.   ask-napsa-font-dir
  639.   (askdir
  640.    (prompt "Select directory where to install Napsaterm fonts.\n")
  641.    (help "    Here you can specify location where to install "
  642.      "the Napsaterm font called `napsa'. "
  643.      "This directory should be in your font path "
  644.      "(i.e. some directory in the assign fonts:).")
  645.    (newpath)
  646.    (default "fonts:")))
  647.  
  648.  (set 
  649.   unpkt-source NapsaFonts-pkt-file
  650.   unpkt-destination (ask-napsa-font-dir)
  651.   unpkt-sdp 1
  652.   unpkt-title-name "NapsaTerm fonts"
  653.   unpkt-title-not "NapsaTerm special fonts"
  654.   )
  655.  (run-unpkt)
  656.  )
  657.  
  658. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  659.  
  660. (procedure
  661.  ;;
  662.  ;; Install passwd and group databases
  663.  ;;
  664.  install-user-databases
  665.  (transcript "Installing user databases")
  666.  (procedure get-mufs-version
  667.         (set mufs-vernum (getversion "multiuser.library" (resident)))
  668.         (set mufs-ver (/ mufs-vernum 65536))
  669.         (set mufs-rev (- mufs-vernum (* ver 65536))))
  670.  (procedure passwd-create
  671.         (copyfiles
  672.          (prompt "Copying " passwd-source " to AmiTCP:db/passwd.")
  673.          (source passwd-source)
  674.          (dest conf-dir)
  675.          (newname "passwd")
  676.          (optional "nofail")))
  677.  (procedure group-create
  678.         (copyfiles
  679.          (prompt "Copying " group-source " to AmiTCP:db/group.")
  680.          (source group-source)
  681.          (dest conf-dir)
  682.          (newname "group")
  683.          (optional "nofail")))
  684.        
  685.  (set passwd-source (tackon conf-dir "passwd-example"))
  686.  (set group-source (tackon conf-dir "group-example"))
  687.  (if (>= @user-level 2)
  688.      (message 
  689.       "\n"
  690.       "Copying user database from file"
  691.       "\n\n\"" passwd-source "\"\n\n"
  692.       "and group database from file"
  693.       "\n\n\"" group-source "\"\n\n"))
  694.  (passwd-create)
  695.  (group-create)
  696.  )
  697.  
  698. (procedure 
  699.  set-must-reboot
  700.  (if (<> (getversion "netinf<o.device" (resident)) 0)
  701.      ((set netinfo-temp-file "t:netinfo-expunge-script")
  702.       (textfile (dest netinfo-temp-file)
  703.         (append (cat 
  704.              "failat 5000\n"
  705.              "avail flush >nil:\n"
  706.              "avail flush >nil:\n"))
  707.         (safe))
  708.       (execute netinfo-temp-file)))
  709.  (set netinfo-version (getversion "netinfo.device" (resident)))
  710.  (if (AND (<> netinfo-version 0)    ; exists
  711.       (< netinfo-version 4))    ; and is old
  712.      ((set must-reboot-after-install 1)
  713.       (message "You seem to have some parts of an old " @app-name 
  714.            " installation running.  Because of this the user "
  715.            "database updating will have no effect before you reboot "
  716.            "your Amiga.\n\n"
  717.            "For this reason you _must_ reboot after the installation "
  718.            "and before the \"Config AmiTCP\" is run."))))
  719.  
  720. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  721. ;;;
  722. ;;; Ask which parts to install
  723. ;;;
  724. ;;; on return following variables will have boolean values:
  725. ;;;
  726. ;;;  do-install-amitcp
  727. ;;;  do-install-drivers
  728. ;;;  do-install-napsafonts
  729. ;;;
  730. (procedure
  731.  ask-install-options
  732.  (set 
  733.   install-options-bitmap
  734.   (askoptions
  735.    (prompt "Select parts to install:\n\n"
  736.        "See the help for explanation on each item.")
  737.    (choices "AmiTCP/IP"
  738.         "Updated Sana-II network drivers"
  739.         "NapsaTerm fonts"
  740.         )
  741.    (default %111)
  742.    (help "    AmiTCP/IP: "
  743.      "The AmiTCP/IP itself. This includes binaries, documentation, "
  744.      "help files and example configuration files.\n"
  745.      "    Updated Sana-II network drivers: "
  746.      "If this option is checked, the Sana-II drivers in Devs:Networks "
  747.      "will be updated. You will be asked for confirmation for each driver.\n"
  748.      "    NapsaTerm fonts: "
  749.      "NapsaTerm has special fonts, that are sized 6×11 pixels and contain "
  750.      "some special VT102 characters. They are suitable for interlaced "
  751.      "screens. If you have normal NTSC or PAL screen, it might be better "
  752.      "to not install these fonts but use Topaz/8 instead.\n"
  753.      ))
  754.   do-install-amitcp (in install-options-bitmap 0)
  755.   do-install-drivers (in install-options-bitmap 1)
  756.   do-install-napsafonts (in install-options-bitmap 2)
  757.   ))
  758.  
  759.  
  760. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  761. ;;;
  762. ;;; Install AmiTCP/IP
  763. ;;;
  764. (procedure 
  765.  install-amitcp
  766.  (select-destination-directory)
  767.  (if (copy-files-to-destination) ; copy AmiTCP/IP files
  768.      (
  769.       ;; update user-startup
  770.       (set uus::commands (cat "assign " atcp-assign " \"" atcp-dest "\"\n"
  771.                   "path " bin-dir " add\n"
  772.                   apipe-mount)
  773.        uus::section @app-name
  774.        uus::file (tackon atcp-assign "addition-to-user-startup"))
  775.       (update-user-startup))
  776.    ))
  777.  
  778. ;;; copy "UnPkt" to RAM: if available
  779. ;;
  780. ;; If UnPkt is not found, then we are not started from the installation disk
  781. ;;
  782. ;;;
  783. (procedure
  784.  set-unpkt-cmd
  785.  (set unpkt-cmd
  786.       (if (exists UnPkt-file)
  787.       ((copyfiles
  788.         (prompt "Copying packet dearchiver to RAM:")
  789.         (source UnPkt-file)
  790.         (dest   "RAM:")
  791.         (safe)
  792.         (optional "nofail"))
  793. ;       "echo")
  794.        "RAM:UnPkt")
  795.     "")))
  796.  
  797. ;;;;;
  798. ;;
  799. ;; Launch Config AmiTCP
  800. ;;
  801. (procedure
  802.   run-config-amitcp
  803.   (set start-config-script "t:start-config-script")
  804.   (textfile 
  805.    (dest start-config-script)
  806.    (append
  807.     ".key foo\n.bra {\n.ket }\n\n"
  808.     "cd " atcp-assign "\n"
  809.     "Stack 20000 ; Installer needs this\n"
  810.     (tackon bin-dir "Installer")
  811.     " SCRIPT \"Config AmiTCP\" APPNAME \"AmiTCP/IP\" LOGFILE config_log_file MINUSER AVERAGE\n"
  812.     )
  813.    (safe))
  814.   (protect start-config-script "+s +e")
  815.   (if (askbool
  816.        (prompt "\nStart \"Config AmiTCP\" to configure the just "
  817.            "installed " @app-name "?")
  818.        (help @app-name " should be configured after the installation. "
  819.          "If you do not want to do the configuration now, you must "
  820.          "do it later by starting the \"Config AmiTCP\" from the "
  821.          "WorkBench icon.\n"))
  822.       (execute start-config-script)))
  823.  
  824. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  825. ;;;
  826. ;;; Installatation sequence
  827. ;;;
  828.  
  829. ;;
  830. ;; Initialize "global" variables to default values (not complete)
  831. ;;
  832. (set
  833.  startup-changed 0
  834.  must-reboot-after-install 0
  835.  )
  836.  
  837. (complete 00) (transcript "On making " app-name ".")
  838. (complete 01) (check-user-level)
  839. (complete 02) (check-system-version)
  840. (complete 03) (check-available-memory)
  841. (complete 04) (check-old-assign)
  842. (complete 05) (check-cpu-type)
  843.  
  844. ;; askdisk for the install-disk1-name?? maybe later...
  845.  
  846. ;; show the README-FIRST file if it exists
  847. (if (exists README-FIRST-file)
  848.     ((run (cat "run " pager-cmd " \"" README-FIRST-file "\" ") (safe))
  849.      (message "    Please read the shown \"Read Me First\" file carefully "
  850.           "before continuing the installation.")))
  851.  
  852.      (set-unpkt-cmd)
  853.      (if (= unpkt-cmd "")
  854.      (abort "    UnPkt command not present on the installation disk!"))
  855.  
  856.      (complete 08) (ask-accept-license)         ;; ask if user accepts the license
  857.      (complete 10) (ask-install-options)
  858.      (complete 15) (if do-install-amitcp (install-amitcp))
  859.      (complete 30) (if do-install-napsafonts (install-napsaterm))
  860.      (complete 35) (if do-install-drivers (update-devices))
  861.      (if do-install-amitcp    ;; Ask if old configuration should be copied
  862.      (
  863.       (set-must-reboot)
  864.       (set old-conf-used 
  865.            (if old-atcp-directory
  866.            (if (exists (tackon old-atcp-directory "bin/startnet") 
  867.                    (noreq))
  868.                ((complete 40)
  869.             (ask-copy-old-configuration)))))
  870.       ;;
  871.       ;; Install user databases if not copied from an old configuration
  872.       ;;
  873.       (if (exists (tackon conf-dir "passwd"))
  874.           (transcript "There is already a user database.")
  875.         ((complete 70)
  876.          (install-user-databases))) ; install passwd/group
  877.       ;;
  878.       ;; Configure AmiTCP/IP is necessary
  879.       ;;
  880.       (complete 90)
  881.       (if (AND (NOT must-reboot-after-install) (NOT old-conf-used))
  882.           ;;
  883.           ;; Spawn the installer on the "Config AmiTCP" with 
  884.           ;; correct options
  885.           (run-config-amitcp)
  886.           ;(configure-amitcp)
  887.         )
  888.       ))
  889.      ;; show something
  890.      (foreach atcp-assign "#?.readme"
  891.           (run (cat "run " pager-cmd) (tackon atcp-assign @each-name)
  892.            (safe)))
  893.  
  894. ;;; All done!
  895. (complete 100)
  896. (exit (if startup-changed 
  897.       (cat "You should reboot your Amiga to enable the changes made "
  898.            "to system startup files.")
  899.     (cat "You must add the contents of the file(s) \"" 
  900.          "addition-to-user-startup\" to your S:User-Startup and "
  901.          "reboot before you can use " @app-name ".\n"))
  902.       (if must-reboot-after-install
  903.       (cat "\nYou MUST reboot before configuring " @app-name ". Start "
  904.            "\"Config AmiTCP\" from WorkBench after the reboot "
  905.            "to configure your new " @app-name " installation.\n")
  906.     ))
  907.  
  908. ;; EOF
  909. ;;
  910.